﻿using ControleRepresentante.Data.Catalogs;
using ControleRepresentante.Data.Helpers;

namespace ControleRepresentante.Data.CatalogSteps
{
    internal class CreateEnderecoTableCatalogStep : CatalogStepBase<ControleRepresentanteCatalogStepTypes>
    {
        protected override ControleRepresentanteCatalogStepTypes CatalogStepType
        {
            get { return ControleRepresentanteCatalogStepTypes.CreateEndereco; }
        }

        public override void Execute(IDataAccess dataAccess)
        {
            new CatalogStepHelper(dataAccess)
                .CreateTable("Endereco")
                    .AddColumn("DetailsHolderId", ColumnType.Guid, false, false)
                    .AddForeignKey("DetailsHolderId", "DetailsHolder", "AttributeHolderId")
                    .AddColumn("Tipo", ColumnType.ShortNumeric, false, false)
                    .AddColumn("Rua", ColumnType.ShortString, false, false)
                    .AddColumn("Numero", ColumnType.ShortString, false, false)
                    .AddColumn("Complemento", ColumnType.LongString, true, false)
                    .AddColumn("Bairro", ColumnType.ShortString, true, false)
                    .AddColumn("CEP", ColumnType.ShortString, true, false)
                    .AddColumn("Cidade", ColumnType.ShortString, false, false)
                    .AddColumn("Estado", ColumnType.ShortString, false, false)
                    .AddColumn("Principal", ColumnType.Boolean, false, false)
                    .AddColumn("Observacao", ColumnType.LongText, true, false);
        }
    }
}